// *** ADDED BY HEADER FIXUP ***
#include <wx/string.h>
#include <wx/xml/xml.h>
// *** END ***
#ifndef LINKTHREAD_H_INCLUDED
#define LINKTHREAD_H_INCLUDED

#include <wx/thread.h>
#include <wx/socket.h>
#include "LoginSet.h"
#include "Alice/Kernel.h"
#include "PhoneAimlManager.h"
#include <string>
class LinkThread:public wxThread
{
	enum ErrorType
	{
		linkFail,
		loginFail
	};
private:
    Kernel *kernel;
	wxSocketBase *sock;
	wxIPV4address addr;
	wxString userName,botName;
	LoginSet* loger;
	PhoneAimlManager *pm;
	time_t timeStamp;
	wxXmlDocument doc;
	wxChar* buff;
	void* Entry();
	void SendString(const wxString& msg);
	void SendLogin(const wxString& msg);
	void SendExit(const wxString& msg);
	void SendRespond(const wxString& msg);
	void SendMsg(const wxString& msg);
	void SendMsg(const std::string& msg);
	void ReceiveString(wxString& msg);
	void OnMessage(wxXmlNode* node);
	void OnRespond(wxXmlNode* node);
	void WriteLog(const wxString& msg);
    wxXmlNode* ReceiveXml(wxXmlDocument& doc);
	void SendSetting();
	~LinkThread();
public:
	LinkThread(Kernel *kernel,wxSocketBase* sock,LoginSet* log,PhoneAimlManager *pm);
};
#endif // LINKTHREAD_H_INCLUDED
